package cn.com.xy.sms.sdk.ui.feature;

import java.util.HashMap;
import java.util.Map;

import org.json.JSONObject;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

public abstract class FeatureView extends RelativeLayout{
    protected JSONObject mFeatureObj;
    protected Map mFeatureMap;
    protected ViewActionListiner mActionListener;
    public static int ACTION_TYPE_CLOSE = 0;

    public FeatureView(Context context, JSONObject featureObj, Map featureMap) {
        super(context);
        mFeatureObj = featureObj;
        mFeatureMap = featureMap;
        init();
    }

    //interact with outer etc Dialog or other custom
    public interface ViewActionListiner{
        public void onActionCall(int type, HashMap<String, Object> extend);
    }
    
    public ViewActionListiner getActionListener() {
        return mActionListener;
    }
    public void setActionListener(ViewActionListiner mActionListener) {
        this.mActionListener = mActionListener;
    }
    
    public void refreshView(){
    };
    
    public void rebindData(JSONObject featureObj,Map featureMap){
        mFeatureObj = featureObj;
        mFeatureMap = featureMap;
    }
    
    public abstract void bindData();
    public abstract void destroyView();
    public abstract boolean isViewLoading();
    protected abstract void init();
}
